/**
 * http://usejsdoc.org/
 */
var request = require('request'),
	querystring = require('querystring');
module.exports = {
	curl_get:function(url,get,callback){
		var org_url = url,
			org_get = get,
			params = {};
		
		if(get){
			if(url.indexOf('?') > -1){
				url = url + '&';
			}else{
				url = url + '?';
			}
		}
		
		url = url + querystring.stringify(get);
		
		params.url = url;
		params.json = true;
		
		request.get(params,function(err,response,result){
			if(err){
				console.log(err);
				callback(result);
			}else{
				callback(result);
			}
		});
	},
	cur_post:function(url,post,callback){
		var org_url = url,
		org_post = post,
		params = {};
	
		params.url = url;
		params.json = true;
		params.form = post;
		
		request.post(params,function(err,response,result){
			if(err){
				console.log(err);
				callback(result);
			}else{
				callback(result);
			}
		});
	}
};

